package com.wunong.smart.address.application.context;

import com.wunong.smart.address.application.request.BaseUserAddressRequest;
import com.wunong.smart.address.domain.UserAddressDomain;
import lombok.Data;

/**
 * 用户地址上下文对象
 *
 * @author create by zealot.zt
 */
@Data
public class UserAddressContext<REQUEST extends BaseUserAddressRequest> {

    /**
     * 领域模型
     */
    private UserAddressDomain domain;

    /**
     * 请求对象
     */
    private REQUEST request;

    public static <REQUEST extends BaseUserAddressRequest> UserAddressContext<REQUEST> of(REQUEST request, UserAddressDomain domain) {
        UserAddressContext<REQUEST> context = UserAddressContext.of(request);
        context.setDomain(domain);
        return context;
    }

    public static <REQUEST extends BaseUserAddressRequest> UserAddressContext<REQUEST> of(REQUEST request) {
        UserAddressContext<REQUEST> context = new UserAddressContext<>();
        context.setRequest(request);
        return context;
    }

}
